package com.leyou.item.service.Impl;

import com.leyou.item.mapper.SpecGroupMapper;
import com.leyou.item.pojo.Category;
import com.leyou.item.pojo.SpecGroup;
import com.leyou.item.service.SpecGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class SpecGroupServiceImpl implements SpecGroupService {

    @Autowired
    private SpecGroupMapper specGroupMapper;

    @Override
    public List<SpecGroup> queryGroupById(Long cid) {

        SpecGroup group = new SpecGroup();
        group.setCid(cid);

        return specGroupMapper.select(group);
    }

    /**
     * 添加规格列表
     *
     * @param
     * @return
     */
    @Override
    public void savesavaGroup(SpecGroup specGroup) {
        specGroupMapper.insert(specGroup);
    }

    /**
     * 修改数据
     * @param specGroup
     */
    @Override
    public void updataGroup(SpecGroup specGroup) {

        specGroupMapper.updateByPrimaryKey(specGroup);
    }

    /**
     * 删除数据
     * @param id
     */
    @Override
    public void delectGroup(Long id) {
        SpecGroup group = new SpecGroup();
        group.setId(id);

        specGroupMapper.delete(group);
    }
}
